/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Andre
 */
@Entity
@Table(name = "furacao")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Furacao.findAll", query = "SELECT f FROM Furacao f"),
    @NamedQuery(name = "Furacao.findByIdFuracao", query = "SELECT f FROM Furacao f WHERE f.idFuracao = :idFuracao"),
    @NamedQuery(name = "Furacao.findByQuantidade", query = "SELECT f FROM Furacao f WHERE f.quantidade = :quantidade")})
public class Furacao implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idFuracao", nullable = false)
    private Integer idFuracao;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "quantidade", nullable = false)
    private double quantidade;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "furacao")
    private List<Roda> rodaList;

    public Furacao() {
    }

    public Furacao(Integer idFuracao) {
        this.idFuracao = idFuracao;
    }

    public Furacao(Integer idFuracao, double quantidade) {
        this.idFuracao = idFuracao;
        this.quantidade = quantidade;
    }

    public Integer getIdFuracao() {
        return idFuracao;
    }

    public void setIdFuracao(Integer idFuracao) {
        this.idFuracao = idFuracao;
    }

    public double getQuantidade() {
        return quantidade;
    }

    public void setQuantidade(double quantidade) {
        this.quantidade = quantidade;
    }

    @XmlTransient
    public List<Roda> getRodaList() {
        return rodaList;
    }

    public void setRodaList(List<Roda> rodaList) {
        this.rodaList = rodaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFuracao != null ? idFuracao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Furacao)) {
            return false;
        }
        Furacao other = (Furacao) object;
        if ((this.idFuracao == null && other.idFuracao != null) || (this.idFuracao != null && !this.idFuracao.equals(other.idFuracao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Furacao[ idFuracao=" + idFuracao + " ]";
    }
    
}
